﻿using GameFramework.Event;
using GameFramework;
using TowerDefence_Zombie.Data;

namespace TowerDefence_Zombie
{
    public class ChangePlacementAreaEventArgs : GameEventArgs
    {
        public static readonly int EventId = typeof(ChangePlacementAreaEventArgs).GetHashCode();

        public int AreaId
        {
            get;
            private set;
        }

        public int TowerId
        {
            get;
            private set;
        }

        public int TowerLevel
        {
            get;
            private set;
        }

        public bool IsUpgrade
        {
            get;
            private set;
        }

        public ChangePlacementAreaEventArgs()
        {
            AreaId = 0;
            TowerId = 0;
            TowerLevel = 0;
        }

        public override int Id
        {
            get
            {
                return EventId;
            }
        }

        public static ChangePlacementAreaEventArgs Create(int towerGridId, int towerId, int towerLevel, bool isUpgrade)
        {
            ChangePlacementAreaEventArgs showPreviewTowerEventArgs = ReferencePool.Acquire<ChangePlacementAreaEventArgs>();
            showPreviewTowerEventArgs.AreaId = towerGridId;
            showPreviewTowerEventArgs.TowerId = towerId;
            showPreviewTowerEventArgs.TowerLevel = towerLevel;
            showPreviewTowerEventArgs.IsUpgrade = isUpgrade;
            return showPreviewTowerEventArgs;
        }

        public override void Clear()
        {
            TowerId = 0;
            AreaId = 0;
            TowerLevel = 0;
            IsUpgrade = false;
        }
    }
}

